<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
    Inherits="Reconciliation.Web.ReconciliationStatus" CodeFile="ReconciliationStatus.aspx.cs" %>

<%@ Register Src="~/Users Control/HeadMenu.ascx" TagName="HeadMenu" TagPrefix="uc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="~/Users Control/StatusComments.ascx" TagName="OrdersComments" TagPrefix="uc1" %>
<%@ Register Src="~/Users Control/Filters.ascx" TagName="ResultFilter" TagPrefix="Flt" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder2" runat="server" ID="ContentMenu">
    <uc1:HeadMenu runat="server" ID="HeadMenu" />
</asp:Content>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server" ID="content1">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1">
    </telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <style type="text/css">
        #<%=RadGrid1.ClientID%> {overflow: visible!important; height: auto!important;}  
        </style>
        
        <script type="text/javascript">
             function pageLoad(sender, eventArgs) {
                 $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
                 
             }

        function viewCaseViewDetails(id)
        {
            newWindow("OrderDetails.aspx?OrderID="+id, "Order"+id, 800, 650, 0, 1);
        }
        function showFilterItem() {
            var grid = $find("<%=RadGrid1.ClientID %>");
            var MasterTable = grid.get_masterTableView().showFilterItem();
            //$find('<%=RadGrid1.ClientID %>').get_masterTableView().showFilterItem();
            var linkbtn = document.getElementById("ctl00_ContentPlaceHolder1_lnkFilter");
            linkbtn.style.display = "none";
            var linkbtn2 = document.getElementById("ctl00_ContentPlaceHolder1_lnkClose");
            linkbtn2.innerHTML = "<%=Resources.Lang.Close.ToString()%>";
            linkbtn2.style.display = "block";
            
            return false;
           
            
        }
        function hideFilterItem() {
            var grid = $find("<%=RadGrid1.ClientID %>");
            var MasterTable = grid.get_masterTableView().hideFilterItem();
           // $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
            var linkbtn = document.getElementById("ctl00_ContentPlaceHolder1_lnkClose");
            linkbtn.style.display = "none";
            var linkbtn2 = document.getElementById("ctl00_ContentPlaceHolder1_lnkFilter");
            linkbtn2.style.display = "block";
            return false;
        } 
        </script>

    </telerik:RadCodeBlock>
    <table>
        <tr>
            <td>
                <Flt:ResultFilter runat="server" ID="FilterControl" />
            </td>
            <td>
                <asp:LinkButton runat="server" ID="lnkFilter" Text="<%$ Resources:Lang, Filter%>"
                    Font-Bold="true" ForeColor="Blue" OnClientClick="return showFilterItem()" />
            </td>
            <td>
                <asp:LinkButton runat="server" ID="lnkClose" Text="" Font-Bold="true" ForeColor="Blue"
                    OnClientClick="return hideFilterItem()" />
            </td>
        </tr>
    </table>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>            
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel Skin="Vista" runat="server" ID="RadAjaxLoadingPanel1" />
    <telerik:RadToolTipManager runat="server" AnimationDuration="300" ShowDelay="200"
        HideDelay="5" ID="RadToolTipManager1" Width="300px" Height="180px" RelativeTo="Element"
        Animation="Slide" Position="BottomCenter" OnAjaxUpdate="OnAjaxUpdate" Skin="Windows7"
        HideEvent="ManualClose" ContentScrolling="Auto" />
    <telerik:RadToolTipManager runat="server" AnimationDuration="300" ShowDelay="200"
        HideDelay="5" ID="RadToolTipManager2" Width="300px" Height="180px" RelativeTo="Element"
        Animation="Slide" Position="BottomCenter" OnAjaxUpdate="OnAjaxUpdate" Skin="Windows7"
        HideEvent="ManualClose" ContentScrolling="Auto" />
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Height="400px" AllowSorting="True"
        AutoGenerateColumns="False" GroupingEnabled="true" AllowFilteringByColumn="true"
        OnNeedDataSource="RadGrid1_NeedDataSource" GroupingSettings-ShowUnGroupButton="true"
        EnableAJAX="True" OnItemDataBound="RadGrid1_ItemDataBound" GridLines="None" ShowGroupPanel="True">
        <MasterTableView EditMode="InPlace">
            <%--<GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldAlias="Date" FieldName="OrderDate" FormatString="{0:D}"
                                HeaderValueSeparator=" from date: "></telerik:GridGroupByField>
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="OrderDate" SortOrder="Descending"></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>--%>
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <%--  <telerik:GridBoundColumn HeaderText="Pattern" UniqueName="column">--%>
                <telerik:GridTemplateColumn AllowFiltering="false" Groupable="false" HeaderText="<%$ Resources:Lang, OrderID%>"
                    UniqueName="OrderID">
                    <ItemTemplate>
                        <asp:HyperLink runat="server" ID="lnkViewDetails" NavigateUrl="javascript:void(0)"
                            Text='<%#(Convert.ToString(DataBinder.Eval(Container.DataItem,"OrderID")))%>' /></ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn ReadOnly="true" HeaderText="<%$ Resources:Lang, Date%>"
                    SortExpression="OrderDate" UniqueName="OrderDate" DataType="System.DateTime">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblInvDate" Text='<%#BasePage.FormatDate(Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"OrderDate"))) %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <%--<telerik:GridBoundColumn AllowFiltering="false" HeaderText="<%$ Resources:Lang, Date%>"
                    DataField="OrderDate" SortExpression="OrderDate" Groupable="true" DataType="System.DateTime"
                    DataFormatString="{0:dd.MM.yy}" UniqueName="OrderDate">
                </telerik:GridBoundColumn>--%>
                <telerik:GridBoundColumn AllowFiltering="true" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true"
                    ShowFilterIcon="false" HeaderText="<%$ Resources:Lang, Bank%>" DataField="BankCode"
                    DataType="System.String" SortExpression="BankCode" Groupable="true" UniqueName="BankCode">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn AllowFiltering="true" CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true"
                    ShowFilterIcon="false" HeaderText="<%$ Resources:Lang, CPC%>" DataField="CpcCode"
                    DataType="System.String" SortExpression="CpcCode" Groupable="true" UniqueName="CpcCode">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn AllowFiltering="false" HeaderText="<%$ Resources:Lang, Expected%>"
                    DataField="CitExpected" DataType="System.Double" Groupable="false" SortExpression="CitExpected"
                    UniqueName="CitExpected" DataFormatString="{0:C}">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn AllowFiltering="false" HeaderText="<%$ Resources:Lang, Physical%>"
                    DataField="CitPhysical" DataType="System.Double" Groupable="false" SortExpression="CitPhysical"
                    DataFormatString="{0:C}" UniqueName="CitPhysical">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn AllowFiltering="true" ShowFilterIcon="true" CurrentFilterFunction="EqualTo"
                    HeaderText="<%$ Resources:Lang, Difference%>" DataType="System.Double" SortExpression="CitDifference"
                    DataFormatString="{0:C}" Groupable="false" DataField="CitDifference" UniqueName="CitDifference">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn AllowFiltering="false" Groupable="false" ItemStyle-Width="20"
                    HeaderText="<%$ Resources:Lang, Comments%>" UniqueName="AuditorComments">
                    <ItemTemplate>
                        <asp:HiddenField runat="server" ID="hiddCaseID" Value='<%# DataBinder.Eval(Container, "DataItem.CaseID") %>' />
                        <asp:LinkButton runat="server" ID="lnkClientComment">
                            <asp:Label runat="server" Width="20" ID="lblClientComment" Text='<%#Convert.ToBoolean(DataBinder.Eval(Container.DataItem,"isClientCommented")) ? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Comment_Client.png\"  border=\"0\"></div>" : "" %>' /></asp:LinkButton><asp:LinkButton
                                runat="server" ID="lnkAuditorComment">
                                <asp:Label runat="server" Width="20" ID="Label1" Text='<%#Convert.ToBoolean(DataBinder.Eval(Container.DataItem,"isAuditorCommented")) ? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Comment_Auditor.png\"  border=\"0\"></div>" : "" %>' /></asp:LinkButton></ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn AllowFiltering="false" ReadOnly="true" HeaderText="<%$ Resources:Lang, Case_Status%>"
                    SortExpression="CaseStatus" Groupable="true" UniqueName="CaseStatus">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblCaseStatus" Text='<%#DataBinder.Eval(Container.DataItem,"CaseStatus")=="Open" ? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Case_Open.png\" border=\"0\"></div>" : Convert.ToString(DataBinder.Eval(Container.DataItem,"CaseStatus"))=="Close" ? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Case_Close.png\" border=\"0\"></div>" :Convert.ToString(DataBinder.Eval(Container.DataItem,"CaseStatus"))=="AwaitingInfo"? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Case_AwaitingInfo.png\" border=\"0\"></div>" :"" %>' />
                        &nbsp;
                        <asp:Label runat="server" ID="lblCaseDate" Text='<%#DataBinder.Eval(Container.DataItem,"StatusDate")==null ? "" : BasePage.FormatDate(Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"StatusDate"))) %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn AllowFiltering="false" ReadOnly="true" Groupable="false"
                    HeaderText="<%$ Resources:Lang, Invoice_Status%>" SortExpression="InvoiceType"
                    UniqueName="InvoiceStatus">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblInvoiceStatus" Text='<%#DataBinder.Eval(Container.DataItem,"InvoiceStatus")==null ? "" : Convert.ToString(DataBinder.Eval(Container.DataItem,"InvoiceStatus"))=="Full" ? "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Fully_Paid.png\" border=\"0\"></div>" : "<div style=\"text-align:center; float:left; padding:1px;\"><img src=\"images/icons/Partially_Paid.png\" border=\"0\"></div>" %>' />
                        &nbsp;
                        <asp:Label runat="server" ID="lblInvoiceDate" Text='<%#DataBinder.Eval(Container.DataItem,"InvoiceDate")==null ? "" : BasePage.FormatDate(Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"StatusDate"))) %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" />
    </telerik:RadGrid>
</asp:Content>
